package com.acme.bankapp.service;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class BankClient {
	private static final int PORT_NUMBER = 2014;
	private static String serverName = "localhost";

	public static void main(String[] args) {
		int i = 0;
		try (Socket requestSocket = new Socket(serverName, PORT_NUMBER);
				PrintWriter out = new PrintWriter(
						requestSocket.getOutputStream(), true);) {
			System.out.println("Connected to server");
			while (i < 100000) {
				i++;
				out.println("accounttype=c;balance=100;overdraft=50;name=Johnhly"
						+ i + ";gender=m;");
				try {
					Thread.sleep(1);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			// 2. get Input and Output streams
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}
